package com.yyyzzz.service.impl;

import com.yyyzzz.DAO.courseDao;
import com.yyyzzz.DAO.impl.courseDaoimpl;
import com.yyyzzz.bean.Course;
import com.yyyzzz.bean.StudentCourse;
import com.yyyzzz.service.courseService;

import java.util.List;

public class courseServiceimpl implements courseService {
    courseDao dao = new courseDaoimpl();

    @Override
    public boolean addCourse(Course course) {
        if (dao.insertCourse(course) != 0) {
            return true;
        } else {
            return false;
        }
    }

    public List<Course> getAll() {
        // TODO Auto-generated method stub
        return dao.selectAll();
    }

    @Override
    public boolean updateCourse(Course course) {
        if (dao.updateCourse(course) == 0) {
            return false;
        }
        return true;
    }




    @Override
    public List selectOneById(String courseId) {
        if (dao.selectOne(courseId) == null) {
            return null;
        }
        return dao.selectOne(courseId);
    }

    @Override
    public int deleteBycourseid(String courseid) {
        return  dao.deleteCourseByid(courseid);
    }
}
